home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
BORL_TIP
/
TI100
/
TI342.ASC
< prev
next >
Wrap
Text File
|
1991-09-11
|
3KB
|
133 lines
PRODUCT : TURBO PASCAL NUMBER : 342
VERSION : 3.02A
OS : PC-DOS, MS-DOS
DATE : October 9, 1986 PAGE : 1/2
TITLE : ADVANCED FILE HANDLING
The following information is presented for advanced users of
Turbo Pascal using MS-DOS or PC-DOS operating systems.
Turbo Pascal uses MS-DOS file handles to open files. Function
call 3DH is used. One of the parameters to this call is the "open
mode," which provides DOS with information about the way you
intend to access the file and what access to allow other
processes (in a networking or future multitasking environment).
Turbo Pascal normally uses an open mode byte of 2, which
designates Compatibility Mode with Read/Write Access and
Inheritance by child processes. By changing the value of this
byte to 0, you may open Read-only files. There may be other
applications for this, especially in a network environment.
Open mode byte for Reset & Rewrite (PC-DOS):
TURBO.COM CSEG:$24C6
TURBO-87.COM CSEG:$1F75
TURBOBCD.COM CSEG:$23CE
Open mode byte for Reset & Rewrite (MS-DOS):
TURBO.COM CSEG:$21EE
TURBO-87.COM CSEG:$1C9D
TURBOBCD.COM CSEG:$20F6
The best way to use this information is to create an absolute
variable pointing to the byte, for example:
var OpenModeByte: byte absolute CSeg:$24C6; (TURBO.COM PC-DOS)
For additional safety, make sure that the value of the byte being
changed is actually 2 before changing it. Remember, change it
back to 2 if you intend to do normal file opening intermixed with
opening of Read-only or shared files. Information on the
different attributes can be found in the DOS 3.0 Technical
Reference Manual.
{ Using TURBO.COM version 3.02A }
var OpenModeByte: byte absolute CSeg:$24C6; (TURBO.COM PC-DOS)
PRODUCT : TURBO PASCAL NUMBER : 342
VERSION : 3.02A
OS : PC-DOS, MS-DOS
DATE : October 9, 1986 PAGE : 2/2
TITLE : ADVANCED FILE HANDLING
Procedure AccessReadOnly;
begin
if not(OpenModeByte in [0, 2]) then
Error
else
OpenModeByte := 0;
end;
procedure AccessReadWrite;
begin
if not(OpenModeByte in [0, 2]) then
Error
else
OpenModeByte := 2;
end;
The open mode byte for overlay, chain, and execute files is
normally 0, Compatibility Mode with Read Access. The addresses
for these mode bytes can be found by searching the run-time
library for the bytes 00 3D. The first occurrence is the one used
for overlay files, and the second is used for Chain and Execute
files.